<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
</head>
<body>
<div id="app">
    <el-page-header
            style="background-color: #0096dc;color: white;line-height: 60px"
            @back="goBack()" content="修改订单页面"></el-page-header>
    <el-card style="width: 600px;height: 800px;margin: 0 auto">
        <el-form label-width="80px">
            <el-form-item label="客户名字">
                <el-input v-model="l.name" type="text"></el-input>
            </el-form-item>
            <el-form-item label="联系方式">
                <el-input v-model="l.phone" type="text"></el-input>
            </el-form-item>
            <el-form-item label="客户地址">
                <el-input v-model="l.address" type="text"></el-input>
            </el-form-item>
            <el-form-item label="价格">
                <el-input v-model="l.price" type="text"></el-input>
            </el-form-item>
            <el-form-item label="预约时间">
                <el-input v-model="l.created" type="text"></el-input>
            </el-form-item>

            <el-form-item>
                <el-button type="success" @click="update()">修改订单</el-button>
            </el-form-item>
        </el-form>
    </el-card>


</div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>

<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function () {
            return {
                dialogImageUrl: '',
                dialogVisible: false,
                l: {id: "", name: "", phone: "", address: "", price: "", created: ""}
            }
        },
        methods: {
            update() {
                var queryString = v.l.id = location.search
                var id = queryString.substring(queryString.indexOf('=') + 1);
                v.l.id = id;
                axios.post("/orderList/update", v.l).then(function () {
                    location.href = "/admin.html";
                })
            },
            goBack() {
                history.back();//返回上一页面
            },
        },
        created: function () {
            axios.get("/orderList/selectById" + location.search).then(function (response) {
                v.l = response.data;
            })

        }
    })
</script>
</html>